<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>

<head>
	<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
	
	<script src="{yun:}$config.sy_weburl{/yun}/js/jquery-1.8.0.min.js?v={yun:}$config.cachecode{/yun}"></script>
	<script src="js/admin_public.js?v={yun:}$config.cachecode{/yun}" language="javascript"></script>
	
	<link href="images/reset.css?v={yun:}$config.cachecode{/yun}" rel="stylesheet" type="text/css" />
	<link href="images/system.css?v={yun:}$config.cachecode{/yun}" rel="stylesheet" type="text/css" />
	<link href="images/table_form.css?v={yun:}$config.cachecode{/yun}" rel="stylesheet" type="text/css" />
	<link href="{yun:}$config.sy_weburl{/yun}/js/layui/css/layui.css?v={yun:}$config.cachecode{/yun}" rel="stylesheet">
	
	<script src="{yun:}$config.sy_weburl{/yun}/js/layui/layui.js?v={yun:}$config.cachecode{/yun}" language="javascript"></script>
	<script src="{yun:}$config.sy_weburl{/yun}/js/layui/phpyun_layer.js?v={yun:}$config.cachecode{/yun}"></script>
	
	<title>后台管理</title>
</head>

<body class="body_ifm">
	
	{yun:}include file="$adminstyle/add_class.htm"{/yun}
	
	<span id="temp"></span>
	
	<div class="infoboxp">
		
		<div class="admin_new_tip">
    		<div class="admin_new_tit"><i class="admin_new_tit_icon"></i>操作提示</div>
    		<div class="admin_new_tip_list_cont">
      			<div class="admin_new_tip_list">该页面展示了网站CRM分类信息，可对CRM分类编辑修改操作。</div>
    		</div>
  		</div>
  		
  		<div class="admin_new_search_box">
  			<a href="javascript:void(0)" onClick="add_class('个人会员分类','450','370','#wname','index.php?m=crmclass&c=save')" class="admin_new_cz_tj" style="margin-left:0px;">+ 添加类别</a>
  			<a href="javascript:void(0)" onclick="make_cache();" class="admin_new_cz_tj" style="margin-left:0px;">更新缓存</a>
  		</div>
  		
  		<div class="clear"></div>

		<iframe id="supportiframe"  name="supportiframe" onload="returnmessage('supportiframe');" style="display:none"></iframe>
		
		<div class="table-list">
			<div class="admin_table_border">
			
				<form action="index.php?m=crmclass&c=del" method="post" id='myform' target="supportiframe">
					
					<table width="100%">
						
						<thead>
							<tr class="admin_table_top">
								<th width="50"><label for="chkall"> <input type="checkbox" id='chkAll' onclick='CheckAll(this.form)' /></label></th>
								<th width="60">分类编号</th>
						        <th align="left" width="400">分类名称<span class="clickup">(点击修改)</span></th>
								<th>{yun:}if empty($id){/yun}分类变量名{yun:}else{/yun}分类排序{yun:}/if{/yun}</th>
								<th width="180" class="admin_table_th_bg">操作</th>
							</tr>
						</thead>
						
						<tbody>
						
					    	{yun:}if empty($id){/yun}
					        	{yun:}foreach item=v key=key from=$position{/yun}
							        <tr align="center" {yun:}if ($key+1)%2=='0'{/yun}class="admin_com_td_bg"{yun:}/if{/yun} id="list{yun:}$v.id{/yun}">
							            <td width="50"><input type="checkbox" value="{yun:}$v.id{/yun}" name='del[]' onclick='unselectall()' rel="del_chk" /></td>
							            <td class="ud">{yun:}$v.id{/yun}</td>
							            <td align="left" class="imghide">
							            	一级分类：<span onClick="checkname('{yun:}$v.id{/yun}');" id="name{yun:}$v.id{/yun}" style="cursor:pointer;">{yun:}$v.name{/yun}</span>
								            <input class="input-text hidden" type="text" id="inputname{yun:}$v.id{/yun}" value="{yun:}$v.name{/yun}" onBlur="subname('{yun:}$v.id{/yun}','index.php?m=crmclass&c=ajax');">
								            <img class="" src="images/xg.png" onClick="checkname('{yun:}$v.id{/yun}');" style="padding-left:5px;cursor:pointer;"/>
							            </td>
							            <td class="ud"><input type="text" name="variable" class="input-text" value="{yun:}$v.variable{/yun}" size="20" disabled/></td>
							            <td class="ud">
							            	<a href="index.php?m=crmclass&c=up&id={yun:}$v.id{/yun}" class="crm_submit ">管理</a> 
							                <a href="javascript:void(0)" onClick="layer_del('确定要删除？', '?m=crmclass&c=del&delid={yun:}$v.id{/yun}');" class="crm_submitqx ">删除</a>
							           	</td>
							        </tr>
					    		{yun:}/foreach{/yun}
							{yun:}/if{/yun}
							
							{yun:}if $id{/yun}
							
								<tr align="center">
							    	<td width="50"><input type="checkbox" value="{yun:}$class1.id{/yun}" name='del[]' onclick='unselectall()' rel="del_chk" /></td>
									<td class="ud" width="60">{yun:}$class1.id{/yun}</td>
									<td align="left">
										一级分类：<span onClick="checkname('{yun:}$class1.id{/yun}');" id="name{yun:}$class1.id{/yun}" style="cursor:pointer;">{yun:}$class1.name{/yun}</span>
							        	<input class="input-text hidden" type="text" id="inputname{yun:}$class1.id{/yun}" value="{yun:}$class1.name{/yun}" onBlur="subname('{yun:}$class1.id{/yun}','index.php?m=crmclass&c=ajax');">
							        </td>
							        <td class="ud"></td>
									<td class="ud" width="180">
										<a href="javascript:void(0)" onClick="layer_del('确定要删除？', 'index.php?m=crmclass&c=del&delid={yun:}$class1.id{/yun}');"class="crm_submitqx ">删除</a>
									</td>
								</tr>
								
								{yun:}foreach item=v from=$class2{/yun}
									
									<tr align="center" id="msg{yun:}$v.id{/yun}">
								    	<td width="50"><input type="checkbox" value="{yun:}$v.id{/yun}" name='del[]' onclick='unselectall()' rel="del_chk" /></td>
										<td class="ud">{yun:}$v.id{/yun}</td>
										<td align="left">
											&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;┗<span onClick="checkname('{yun:}$v.id{/yun}');" id="name{yun:}$v.id{/yun}" style="cursor:pointer;">{yun:}$v.name{/yun}</span>
								        	<input class="input-text hidden" type="text" id="inputname{yun:}$v.id{/yun}" value="{yun:}$v.name{/yun}" onBlur="subname('{yun:}$v.id{/yun}','index.php?m=crmclass&c=ajax');">
											<img class="" src="images/xg.png" onClick="checkname('{yun:}$v.id{/yun}');" style="padding-left:5px;cursor:pointer;"/>
										</td>
								        <td>
								        	<span onClick="checksort('{yun:}$v.id{/yun}');" id="sort{yun:}$v.id{/yun}" style="cursor:pointer;">{yun:}if !$v.sort{/yun}0{yun:}else{/yun}{yun:}$v.sort{/yun}{yun:}/if{/yun}</span>
								        	<input class="input-text hidden" type="text" id="input{yun:}$v.id{/yun}" size="10" value="{yun:}$v.sort{/yun}" onBlur="subsort('{yun:}$v.id{/yun}','index.php?m=crmclass&c=ajax');">
								       		<img style="padding-left:5px;cursor:pointer;" title="" src="images/xg.png" onClick="checksort('{yun:}$v.id{/yun}');"/>
								       	</td>
										<td class="ud">
											
											<a href="javascript:void(0)" onClick="layer_del('确定要删除？', 'index.php?m=crmclass&c=del&delid={yun:}$v.id{/yun}');"class="crm_submitqx ">删除</a>
										</td>
									</tr>
										  
								{yun:}/foreach{/yun}
								
							{yun:}/if{/yun}
							
					  		<tr style="background:#f1f1f1;">
					    		<td align="center"><input type="checkbox" id='chkAll2' onclick='CheckAll2(this.form)' /></td>
					    		<td colspan="4" >
					    			<label for="chkAll2">全选</label>&nbsp;
					      			<input class="admin_button"  type="button" name="delsub" value="删除所选"  onclick="return really('del[]')"/>
					      		</td>
					    	</tr>
					    	
					   	</tbody>
					</table>
					<input type="hidden" name="pytoken" id='pytoken' value="{yun:}$pytoken{/yun}">
				</form>
			</div>
		</div>
	</div>
	
	<script>
		function make_cache(){
			loadlayer();
			$.get("index.php?m=crmclass&c=upCache",function(msg){
				parent.layer.closeAll('loading');
				if(msg==1){
					parent.layer.msg("更新成功！",2,9);
				}else{
					parent.layer.msg("更新失败！",2,8);
				}
				return false; 
			});
		}
	</script>
	
</body>
</html>